package optimizers.commons.evaluator;

import java.util.ArrayList;
import java.util.HashMap;

import common.Static;

import optimizers.commons.Parameter;
import optimizers.commons.RunConfig;
import optimizers.ganeat.math.IndividualMath;
import model.OligoSystemGeneral;
import fitness.FitnessResult;
import fitness.MathFitness;

public class RobustnessEvaluator {
	private static int nBatch = 50;
	private static int batchSize = 200;
	public static ArrayList<Double> defaultParams;

	public static void main(String[] args) {
		RunConfig config = new RunConfig();
		config.inhK = new Parameter(RunConfig.INHK_OPTIMIZE_NO_PRESET, 0, 0, 0,
				new double[] {});
		FitnessEvaluationService evaluationService = new FitnessEvaluationService(
				9, new MathFitness(), null, null);
		IndividualMath indiv = new IndividualMath(
				new HashMap<String, Integer>(), new HashMap<String, String>(),
				-1, 0, config, Static.prototypes.get("Square 3"));
		defaultParams = indiv.getOligoModel().getSeqK();
		for (int i = 0; i < nBatch; i++) {
			OligoSystemGeneral[] curGen = createNoisyBatch(indiv
					.getOligoModel());
			FitnessResult[] fitnessResult = evaluationService
					.evaluateFitness(curGen);
		}
	}

	private static OligoSystemGeneral[] createNoisyBatch(
			OligoSystemGeneral oligoSystem) {
		OligoSystemGeneral[] result = new OligoSystemGeneral[batchSize];
		for (int i = 0; i < result.length; i++) {
			result[i] = oligoSystem.getNoisyVersion();
		}
		return result;
	}
}
